let form = layui.form;
form.verify({
  len: [/^\S{6,12}$/, "请输入6-12位的密码"],
  same: function (val) {
    if (val !== $("[name=password]").val()) {
      return "两次输入密码不一致";
    }
  },
});
//---------------------添加用户------------------------
$("form").on("submit", function (e) {
  e.preventDefault();
  let str = $(this).serialize();
  str.substring("");
  console.log(str);
  $.ajax({
    type: "post",
    url: "/admin/users",
    data: str,
    success: function (res) {
      layer.msg(res.message, { time: 1000 }, function () {
        if (res.status === 0) {
          location = "./user.html";
        }
      });
    },
  });
});
